package com.itheima.user.sentinel;

import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.RequestOriginParser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;

/**
 * @Description:
 * @Version: V1.0
 */
@Component
@Slf4j
public class IPLimiter implements RequestOriginParser {

    @Override
    public String parseOrigin(HttpServletRequest request) {

        log.info(request.getRemoteAddr());

        return request.getRemoteAddr();  // IP
    }

}
